{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Imports\n",
    "\n",
    "Import all the modules and functionalities we need."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "# Import standard libraries.\n",
    "import os\n",
    "\n",
    "# Import third party libraries.\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "\n",
    "# Import custom libraries/scripts.\n",
    "import annotations\n",
    "import helpers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Loading data\n",
    "\n",
    "Fetch all our relevant data for the current analysis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# Set working contants.\n",
    "EXPERIMENTS_PATH = r'E:\\Miguel\\PhD\\Results\\Competition\\DL\\Four-Arena Setup\\WT_mating_status\\processed'\n",
    "FPS = 60\n",
    "N_MINUTES = 60\n",
    "N_FRAMES = N_MINUTES * 60 * FPS\n",
    "INK = 'black'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# Set figure configurations.\n",
    "sns.set(\n",
    "        context='paper',\n",
    "        style='ticks',\n",
    "        font='sans-serif',\n",
    "        font_scale=1.0, \n",
    "        rc={\n",
    "            'axes.axisbelow': True,\n",
    "            'axes.edgecolor': INK,\n",
    "            'axes.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'axes.grid': False,\n",
    "            'axes.labelcolor': INK,\n",
    "            'axes.labelsize': 13.0,\n",
    "            'axes.labelweight': 'normal',\n",
    "            'axes.linewidth': 1.0,\n",
    "            'axes.spines.left': True,\n",
    "            'axes.spines.bottom': True,\n",
    "            'axes.spines.top': False,\n",
    "            'axes.spines.right': False,\n",
    "            'axes.titlepad': 15.0,\n",
    "            'axes.titlesize': 20.0,\n",
    "            'axes.titleweight': 'bold',\n",
    "            'figure.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'figure.figsize': [6.0, 4.0],\n",
    "            'figure.titlesize': 30.0,\n",
    "            'figure.titleweight': 'bold',\n",
    "            'font.family': ['sans-serif'],\n",
    "            'font.sans-serif': ['Arial'],\n",
    "            'legend.frameon': False,\n",
    "            'legend.fontsize': 11.0,\n",
    "            'lines.color': INK,\n",
    "            'lines.linewidth': 1.0,\n",
    "            'patch.edgecolor': INK,\n",
    "            'savefig.dpi': 300,\n",
    "            'savefig.format': 'png',\n",
    "            'savefig.bbox': 'tight',\n",
    "            'savefig.transparent': True,\n",
    "            'text.color': INK,\n",
    "            'text.usetex': False,\n",
    "            'xtick.color': INK,\n",
    "            'xtick.direction': 'out',\n",
    "            'xtick.labelsize': 12.0,\n",
    "            'xtick.major.pad': 5.0,\n",
    "            'xtick.major.size': 0.0,\n",
    "            'xtick.major.width': 1.0,\n",
    "            'xtick.minor.size': 0.0,\n",
    "            'xtick.minor.width': 0.4,\n",
    "            'ytick.color': INK,\n",
    "            'ytick.direction': 'out',\n",
    "            'ytick.labelsize': 12.0,\n",
    "            'ytick.major.pad': 5.0,\n",
    "            'ytick.major.size': 3.0,\n",
    "            'ytick.major.width': 1.0,\n",
    "            'ytick.minor.size': 0.0,\n",
    "            'ytick.minor.width': 0.4\n",
    "           }\n",
    "       )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Folder already exists, skipping.\n"
     ]
    }
   ],
   "source": [
    "# Prepare the Figures folder to save our graphs in.\n",
    "savepath = os.path.join(r'C:\\Users\\Miguel\\Desktop\\paper_data', 'paper_figures', 'figureS1')\n",
    "try:\n",
    "    os.makedirs(savepath)\n",
    "    print('New folder created.')\n",
    "except FileExistsError:\n",
    "    print('Folder already exists, skipping.')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Paths to conditions:\n",
      " ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin']\n"
     ]
    }
   ],
   "source": [
    "# Set the conditions to analyze.\n",
    "condition_order = ['virgin_virgin']\n",
    "conditions = [item.path for item in os.scandir(EXPERIMENTS_PATH) if item.name in condition_order]\n",
    "print('Paths to conditions:\\n', conditions)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['video_2017-09-05T15_42_04_arena3', 'video_2017-09-07T13_28_02_arena4']\n",
      "2\n"
     ]
    }
   ],
   "source": [
    "# Create a list of all the experiments that we DO NOT want to analyze.\n",
    "intruders = []\n",
    "for condition_path in conditions:\n",
    "    condition = os.path.basename(condition_path)\n",
    "    for file in os.listdir(condition_path):\n",
    "        if 'quality_control' in file:\n",
    "\n",
    "            # Read the quality.csv file to check which experiments are usable for analysis.\n",
    "            quality_file = os.path.join(condition_path, file)\n",
    "            quality_df = pd.read_csv(quality_file, usecols=[0,1], index_col=0)\n",
    "            quality_df = quality_df[quality_df['is_usable'] == False].index.values\n",
    "\n",
    "            for value in quality_df:\n",
    "                intruders.append(value + '_slice1' if condition=='virgin_added' else value)\n",
    "\n",
    "print(intruders)             \n",
    "print(len(intruders))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t\n",
      " virgin_virgin\n",
      "Copulation too short: video_2017-09-06T13_42_13_arena3\n",
      "Copulation too short: video_2017-09-26T14_52_18_arena3\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'virgin_virgin': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-05T13_28_41_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-05T14_34_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-06T13_42_13_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-06T14_45_32_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-07T14_37_38_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-07T14_37_38_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-08T13_26_13_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T13_30_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T14_36_55_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T16_18_15_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-13T14_34_18_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-20T13_43_53_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-20T14_48_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-21T13_38_55_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-21T15_57_23_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-26T13_40_19_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T13_36_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T14_44_01_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T15_55_49_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-12T15_50_43_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-13T16_06_33_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-18T15_19_17_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-19T13_50_56_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-20T13_21_06_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-20T15_44_09_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-24T16_13_35_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-25T14_55_12_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T13_37_48_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T14_48_28_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T16_11_06_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-03T14_54_45_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-03T16_20_50_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-12-20T12_58_51_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-12-20T14_01_01_arena3']}"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Load all usable experiments for each condition.\n",
    "experiments = {condition: [] for condition in condition_order}\n",
    "\n",
    "for condition_path in conditions:\n",
    "    \n",
    "    condition = os.path.basename(condition_path)\n",
    "    print('\\t\\n', condition)\n",
    "    \n",
    "    for item in os.scandir(condition_path):\n",
    "        if item.is_dir() and item.name not in intruders:\n",
    "            \n",
    "            annotation_video = annotations.read(item.path.split('_slice')[0] + '.csv')\n",
    "            \n",
    "            try:\n",
    "                copulation = annotation_video[0].events[0]\n",
    "\n",
    "                # Filter out videos where copulation is interrupted.\n",
    "                copulation_end = copulation.time_interval[1]\n",
    "                if copulation_end==N_FRAMES:\n",
    "                    print('Copulation interrupted:', item.name)\n",
    "                    continue\n",
    "\n",
    "                # Filter out videos where copulation lasts less than 8 minutes.\n",
    "                copulation_duration = copulation.duration\n",
    "                if copulation_duration <= 8 * 60 * FPS:\n",
    "                    print('Copulation too short:', item.name)\n",
    "                    continue\n",
    "            \n",
    "            except IndexError:\n",
    "                continue\n",
    "\n",
    "            experiments[condition].append(item.path.split('_slice')[0])\n",
    "\n",
    "experiments"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Copulation Analysis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "scrolled": true,
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iteration:  0 \n",
      "Experiment: video_2017-09-05T13_28_41_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  1 \n",
      "Experiment: video_2017-09-05T14_34_55_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  2 \n",
      "Experiment: video_2017-09-06T13_42_13_arena1 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  3 \n",
      "Experiment: video_2017-09-06T14_45_32_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  4 \n",
      "Experiment: video_2017-09-07T14_37_38_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  5 \n",
      "Experiment: video_2017-09-07T14_37_38_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  6 \n",
      "Experiment: video_2017-09-08T13_26_13_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  7 \n",
      "Experiment: video_2017-09-12T13_30_06_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  8 \n",
      "Experiment: video_2017-09-12T14_36_55_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  9 \n",
      "Experiment: video_2017-09-12T16_18_15_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  10 \n",
      "Experiment: video_2017-09-13T14_34_18_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  11 \n",
      "Experiment: video_2017-09-20T13_43_53_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  12 \n",
      "Experiment: video_2017-09-20T14_48_55_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  13 \n",
      "Experiment: video_2017-09-21T13_38_55_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  14 \n",
      "Experiment: video_2017-09-21T15_57_23_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  15 \n",
      "Experiment: video_2017-09-26T13_40_19_arena1 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  16 \n",
      "Experiment: video_2017-09-28T13_36_06_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  17 \n",
      "Experiment: video_2017-09-28T14_44_01_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  18 \n",
      "Experiment: video_2017-09-28T15_55_49_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  19 \n",
      "Experiment: video_2017-10-12T15_50_43_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  20 \n",
      "Experiment: video_2017-10-13T16_06_33_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  21 \n",
      "Experiment: video_2017-10-18T15_19_17_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  22 \n",
      "Experiment: video_2017-10-19T13_50_56_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  23 \n",
      "Experiment: video_2017-10-20T13_21_06_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  24 \n",
      "Experiment: video_2017-10-20T15_44_09_arena2 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  25 \n",
      "Experiment: video_2017-10-24T16_13_35_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  26 \n",
      "Experiment: video_2017-10-25T14_55_12_arena1 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  27 \n",
      "Experiment: video_2017-11-02T13_37_48_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  28 \n",
      "Experiment: video_2017-11-02T14_48_28_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  29 \n",
      "Experiment: video_2017-11-02T16_11_06_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  30 \n",
      "Experiment: video_2017-11-03T14_54_45_arena1 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  31 \n",
      "Experiment: video_2017-11-03T16_20_50_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  32 \n",
      "Experiment: video_2017-12-20T12_58_51_arena4 \n",
      "Condition:  virgin_virgin \n",
      "\n",
      "Iteration:  33 \n",
      "Experiment: video_2017-12-20T14_01_01_arena3 \n",
      "Condition:  virgin_virgin \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_cop</th>\n",
       "      <th>duration</th>\n",
       "      <th>duration_mins</th>\n",
       "      <th>has_second_cop</th>\n",
       "      <th>second_cop_duration</th>\n",
       "      <th>second_cop_duration_mins</th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "      <th>mark</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>42083</td>\n",
       "      <td>11.689722</td>\n",
       "      <td>True</td>\n",
       "      <td>47739.0</td>\n",
       "      <td>13.260833</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "      <td>unpainted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>54966</td>\n",
       "      <td>15.268333</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>37771</td>\n",
       "      <td>10.491944</td>\n",
       "      <td>True</td>\n",
       "      <td>52471.0</td>\n",
       "      <td>14.575278</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1</td>\n",
       "      <td>unpainted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>51519</td>\n",
       "      <td>14.310833</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T14_45_32_arena3</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>46945</td>\n",
       "      <td>13.040278</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-07T14_37_38_arena3</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>True</td>\n",
       "      <td>52113</td>\n",
       "      <td>14.475833</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-07T14_37_38_arena4</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>True</td>\n",
       "      <td>51341</td>\n",
       "      <td>14.261389</td>\n",
       "      <td>True</td>\n",
       "      <td>17264.0</td>\n",
       "      <td>4.795556</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-08T13_26_13_arena3</td>\n",
       "      <td>unpainted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>True</td>\n",
       "      <td>51800</td>\n",
       "      <td>14.388889</td>\n",
       "      <td>True</td>\n",
       "      <td>53866.0</td>\n",
       "      <td>14.962778</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-12T13_30_06_arena4</td>\n",
       "      <td>unpainted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>True</td>\n",
       "      <td>43538</td>\n",
       "      <td>12.093889</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-12T14_36_55_arena3</td>\n",
       "      <td>unpainted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>True</td>\n",
       "      <td>49664</td>\n",
       "      <td>13.795556</td>\n",
       "      <td>True</td>\n",
       "      <td>70108.0</td>\n",
       "      <td>19.474444</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-12T16_18_15_arena4</td>\n",
       "      <td>unpainted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>True</td>\n",
       "      <td>57826</td>\n",
       "      <td>16.062778</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-13T14_34_18_arena2</td>\n",
       "      <td>unpainted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>True</td>\n",
       "      <td>48830</td>\n",
       "      <td>13.563889</td>\n",
       "      <td>True</td>\n",
       "      <td>56818.0</td>\n",
       "      <td>15.782778</td>\n",
       "      <td>False</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-20T13_43_53_arena3</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>True</td>\n",
       "      <td>31237</td>\n",
       "      <td>8.676944</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-20T14_48_55_arena2</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>True</td>\n",
       "      <td>62242</td>\n",
       "      <td>17.289444</td>\n",
       "      <td>True</td>\n",
       "      <td>47042.0</td>\n",
       "      <td>13.067222</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-21T13_38_55_arena4</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>True</td>\n",
       "      <td>49279</td>\n",
       "      <td>13.688611</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-21T15_57_23_arena2</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>True</td>\n",
       "      <td>52762</td>\n",
       "      <td>14.656111</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-26T13_40_19_arena1</td>\n",
       "      <td>unpainted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>True</td>\n",
       "      <td>48145</td>\n",
       "      <td>13.373611</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-28T13_36_06_arena4</td>\n",
       "      <td>unpainted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>True</td>\n",
       "      <td>49190</td>\n",
       "      <td>13.663889</td>\n",
       "      <td>True</td>\n",
       "      <td>34252.0</td>\n",
       "      <td>9.514444</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-28T14_44_01_arena3</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>True</td>\n",
       "      <td>59315</td>\n",
       "      <td>16.476389</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-28T15_55_49_arena3</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>True</td>\n",
       "      <td>31342</td>\n",
       "      <td>8.706111</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-12T15_50_43_arena2</td>\n",
       "      <td>unpainted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>True</td>\n",
       "      <td>48449</td>\n",
       "      <td>13.458056</td>\n",
       "      <td>True</td>\n",
       "      <td>50309.0</td>\n",
       "      <td>13.974722</td>\n",
       "      <td>False</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-13T16_06_33_arena2</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>True</td>\n",
       "      <td>53185</td>\n",
       "      <td>14.773611</td>\n",
       "      <td>True</td>\n",
       "      <td>68591.0</td>\n",
       "      <td>19.053056</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-18T15_19_17_arena3</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>True</td>\n",
       "      <td>41492</td>\n",
       "      <td>11.525556</td>\n",
       "      <td>True</td>\n",
       "      <td>31649.0</td>\n",
       "      <td>8.791389</td>\n",
       "      <td>False</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-19T13_50_56_arena2</td>\n",
       "      <td>unpainted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>True</td>\n",
       "      <td>56822</td>\n",
       "      <td>15.783889</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-20T13_21_06_arena2</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>True</td>\n",
       "      <td>53680</td>\n",
       "      <td>14.911111</td>\n",
       "      <td>True</td>\n",
       "      <td>45348.0</td>\n",
       "      <td>12.596667</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-20T15_44_09_arena2</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>True</td>\n",
       "      <td>54361</td>\n",
       "      <td>15.100278</td>\n",
       "      <td>True</td>\n",
       "      <td>59955.0</td>\n",
       "      <td>16.654167</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-24T16_13_35_arena4</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>True</td>\n",
       "      <td>55756</td>\n",
       "      <td>15.487778</td>\n",
       "      <td>True</td>\n",
       "      <td>44104.0</td>\n",
       "      <td>12.251111</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-25T14_55_12_arena1</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>True</td>\n",
       "      <td>53095</td>\n",
       "      <td>14.748611</td>\n",
       "      <td>True</td>\n",
       "      <td>47180.0</td>\n",
       "      <td>13.105556</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T13_37_48_arena3</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>True</td>\n",
       "      <td>50251</td>\n",
       "      <td>13.958611</td>\n",
       "      <td>True</td>\n",
       "      <td>55243.0</td>\n",
       "      <td>15.345278</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T14_48_28_arena4</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>True</td>\n",
       "      <td>45490</td>\n",
       "      <td>12.636111</td>\n",
       "      <td>True</td>\n",
       "      <td>51606.0</td>\n",
       "      <td>14.335000</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T16_11_06_arena3</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>True</td>\n",
       "      <td>39298</td>\n",
       "      <td>10.916111</td>\n",
       "      <td>True</td>\n",
       "      <td>52324.0</td>\n",
       "      <td>14.534444</td>\n",
       "      <td>False</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-03T14_54_45_arena1</td>\n",
       "      <td>unpainted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>True</td>\n",
       "      <td>60583</td>\n",
       "      <td>16.828611</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-03T16_20_50_arena4</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>True</td>\n",
       "      <td>38850</td>\n",
       "      <td>10.791667</td>\n",
       "      <td>True</td>\n",
       "      <td>47116.0</td>\n",
       "      <td>13.087778</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-12-20T12_58_51_arena4</td>\n",
       "      <td>painted</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>True</td>\n",
       "      <td>37529</td>\n",
       "      <td>10.424722</td>\n",
       "      <td>True</td>\n",
       "      <td>52808.0</td>\n",
       "      <td>14.668889</td>\n",
       "      <td>True</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-12-20T14_01_01_arena3</td>\n",
       "      <td>unpainted</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    has_cop  duration  duration_mins  has_second_cop  second_cop_duration  \\\n",
       "0      True     42083      11.689722            True              47739.0   \n",
       "1      True     54966      15.268333           False                  NaN   \n",
       "2      True     37771      10.491944            True              52471.0   \n",
       "3      True     51519      14.310833           False                  NaN   \n",
       "4      True     46945      13.040278           False                  NaN   \n",
       "5      True     52113      14.475833           False                  NaN   \n",
       "6      True     51341      14.261389            True              17264.0   \n",
       "7      True     51800      14.388889            True              53866.0   \n",
       "8      True     43538      12.093889           False                  NaN   \n",
       "9      True     49664      13.795556            True              70108.0   \n",
       "10     True     57826      16.062778           False                  NaN   \n",
       "11     True     48830      13.563889            True              56818.0   \n",
       "12     True     31237       8.676944           False                  NaN   \n",
       "13     True     62242      17.289444            True              47042.0   \n",
       "14     True     49279      13.688611           False                  NaN   \n",
       "15     True     52762      14.656111           False                  NaN   \n",
       "16     True     48145      13.373611           False                  NaN   \n",
       "17     True     49190      13.663889            True              34252.0   \n",
       "18     True     59315      16.476389           False                  NaN   \n",
       "19     True     31342       8.706111           False                  NaN   \n",
       "20     True     48449      13.458056            True              50309.0   \n",
       "21     True     53185      14.773611            True              68591.0   \n",
       "22     True     41492      11.525556            True              31649.0   \n",
       "23     True     56822      15.783889           False                  NaN   \n",
       "24     True     53680      14.911111            True              45348.0   \n",
       "25     True     54361      15.100278            True              59955.0   \n",
       "26     True     55756      15.487778            True              44104.0   \n",
       "27     True     53095      14.748611            True              47180.0   \n",
       "28     True     50251      13.958611            True              55243.0   \n",
       "29     True     45490      12.636111            True              51606.0   \n",
       "30     True     39298      10.916111            True              52324.0   \n",
       "31     True     60583      16.828611           False                  NaN   \n",
       "32     True     38850      10.791667            True              47116.0   \n",
       "33     True     37529      10.424722            True              52808.0   \n",
       "\n",
       "    second_cop_duration_mins  has_aggression      condition  \\\n",
       "0                  13.260833            True  virgin_virgin   \n",
       "1                        NaN            True  virgin_virgin   \n",
       "2                  14.575278            True  virgin_virgin   \n",
       "3                        NaN            True  virgin_virgin   \n",
       "4                        NaN            True  virgin_virgin   \n",
       "5                        NaN            True  virgin_virgin   \n",
       "6                   4.795556            True  virgin_virgin   \n",
       "7                  14.962778            True  virgin_virgin   \n",
       "8                        NaN           False  virgin_virgin   \n",
       "9                  19.474444            True  virgin_virgin   \n",
       "10                       NaN            True  virgin_virgin   \n",
       "11                 15.782778           False  virgin_virgin   \n",
       "12                       NaN            True  virgin_virgin   \n",
       "13                 13.067222            True  virgin_virgin   \n",
       "14                       NaN            True  virgin_virgin   \n",
       "15                       NaN            True  virgin_virgin   \n",
       "16                       NaN           False  virgin_virgin   \n",
       "17                  9.514444            True  virgin_virgin   \n",
       "18                       NaN           False  virgin_virgin   \n",
       "19                       NaN           False  virgin_virgin   \n",
       "20                 13.974722           False  virgin_virgin   \n",
       "21                 19.053056            True  virgin_virgin   \n",
       "22                  8.791389           False  virgin_virgin   \n",
       "23                       NaN            True  virgin_virgin   \n",
       "24                 12.596667            True  virgin_virgin   \n",
       "25                 16.654167            True  virgin_virgin   \n",
       "26                 12.251111            True  virgin_virgin   \n",
       "27                 13.105556            True  virgin_virgin   \n",
       "28                 15.345278            True  virgin_virgin   \n",
       "29                 14.335000            True  virgin_virgin   \n",
       "30                 14.534444           False  virgin_virgin   \n",
       "31                       NaN            True  virgin_virgin   \n",
       "32                 13.087778            True  virgin_virgin   \n",
       "33                 14.668889            True  virgin_virgin   \n",
       "\n",
       "                          experiment       mark  \n",
       "0   video_2017-09-05T13_28_41_arena4  unpainted  \n",
       "1   video_2017-09-05T14_34_55_arena2    painted  \n",
       "2   video_2017-09-06T13_42_13_arena1  unpainted  \n",
       "3   video_2017-09-06T14_45_32_arena3    painted  \n",
       "4   video_2017-09-07T14_37_38_arena3    painted  \n",
       "5   video_2017-09-07T14_37_38_arena4    painted  \n",
       "6   video_2017-09-08T13_26_13_arena3  unpainted  \n",
       "7   video_2017-09-12T13_30_06_arena4  unpainted  \n",
       "8   video_2017-09-12T14_36_55_arena3  unpainted  \n",
       "9   video_2017-09-12T16_18_15_arena4  unpainted  \n",
       "10  video_2017-09-13T14_34_18_arena2  unpainted  \n",
       "11  video_2017-09-20T13_43_53_arena3    painted  \n",
       "12  video_2017-09-20T14_48_55_arena2    painted  \n",
       "13  video_2017-09-21T13_38_55_arena4    painted  \n",
       "14  video_2017-09-21T15_57_23_arena2    painted  \n",
       "15  video_2017-09-26T13_40_19_arena1  unpainted  \n",
       "16  video_2017-09-28T13_36_06_arena4  unpainted  \n",
       "17  video_2017-09-28T14_44_01_arena3    painted  \n",
       "18  video_2017-09-28T15_55_49_arena3    painted  \n",
       "19  video_2017-10-12T15_50_43_arena2  unpainted  \n",
       "20  video_2017-10-13T16_06_33_arena2    painted  \n",
       "21  video_2017-10-18T15_19_17_arena3    painted  \n",
       "22  video_2017-10-19T13_50_56_arena2  unpainted  \n",
       "23  video_2017-10-20T13_21_06_arena2    painted  \n",
       "24  video_2017-10-20T15_44_09_arena2    painted  \n",
       "25  video_2017-10-24T16_13_35_arena4    painted  \n",
       "26  video_2017-10-25T14_55_12_arena1    painted  \n",
       "27  video_2017-11-02T13_37_48_arena3    painted  \n",
       "28  video_2017-11-02T14_48_28_arena4    painted  \n",
       "29  video_2017-11-02T16_11_06_arena3    painted  \n",
       "30  video_2017-11-03T14_54_45_arena1  unpainted  \n",
       "31  video_2017-11-03T16_20_50_arena4    painted  \n",
       "32  video_2017-12-20T12_58_51_arena4    painted  \n",
       "33  video_2017-12-20T14_01_01_arena3  unpainted  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "copulation_df = pd.DataFrame()\n",
    "\n",
    "for condition in condition_order:\n",
    "    for h, experiment_path in enumerate(experiments[condition]):\n",
    "\n",
    "        experiment = os.path.basename(experiment_path)\n",
    "\n",
    "        print('Iteration: ', h, '\\nExperiment:', experiment, '\\nCondition: ', condition, '\\n')\n",
    "\n",
    "        # Read .csv annotation files.\n",
    "        annotation_video = annotations.read(experiment_path + '.csv')\n",
    "        copulation_events = annotation_video[0].events\n",
    "        n_copulations = len(copulation_events)\n",
    "        \n",
    "        aggression_events = annotation_video[1].events\n",
    "\n",
    "        if n_copulations==0:\n",
    "            copulation_data = pd.DataFrame({'has_cop': False,\n",
    "                                            'duration': np.nan,\n",
    "                                            'duration_mins': np.nan,\n",
    "                                            'has_second_cop': False,\n",
    "                                            'second_cop_duration': np.nan,\n",
    "                                            'second_cop_duration_mins': np.nan,\n",
    "                                            'has_aggression': False,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment,\n",
    "                                            'mark': np.nan},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        if n_copulations==1:\n",
    "            copulation_comment = annotation_video[0].events[0].comment.split('_')[0] if condition in ['virgin_virgin', 'virgin_mated24h', 'virgin_mated2h'] else np.nan\n",
    "            copulation_data = pd.DataFrame({'has_cop': True,\n",
    "                                            'duration': copulation_events[0].duration,\n",
    "                                            'duration_mins': copulation_events[0].duration / (60 * FPS),\n",
    "                                            'has_second_cop': False,\n",
    "                                            'second_cop_duration': np.nan,\n",
    "                                            'second_cop_duration_mins': np.nan,\n",
    "                                            'has_aggression': False if len(aggression_events) == 0 else True,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment,\n",
    "                                            'mark': copulation_comment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        if n_copulations==2:\n",
    "            copulation_comment = annotation_video[0].events[0].comment.split('_')[0] if condition in ['virgin_virgin', 'virgin_mated24h', 'virgin_mated2h'] else np.nan\n",
    "            copulation_data = pd.DataFrame({'has_cop': True,\n",
    "                                            'duration': copulation_events[0].duration,\n",
    "                                            'duration_mins': copulation_events[0].duration / (60 * FPS),\n",
    "                                            'has_second_cop': True,\n",
    "                                            'second_cop_duration': copulation_events[1].duration,\n",
    "                                            'second_cop_duration_mins':copulation_events[1].duration / (60 * FPS),\n",
    "                                            'has_aggression': False if len(aggression_events) == 0 else True,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment,\n",
    "                                            'mark': copulation_comment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        copulation_df = pd.concat([copulation_df, copulation_data], ignore_index=True)\n",
    "\n",
    "copulation_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "      <th>duration_mins</th>\n",
       "      <th>has_aggression</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "      <td>11.689722</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2</td>\n",
       "      <td>15.268333</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1</td>\n",
       "      <td>10.491944</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T14_45_32_arena3</td>\n",
       "      <td>14.310833</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-07T14_37_38_arena3</td>\n",
       "      <td>13.040278</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-07T14_37_38_arena4</td>\n",
       "      <td>14.475833</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-08T13_26_13_arena3</td>\n",
       "      <td>14.261389</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-12T13_30_06_arena4</td>\n",
       "      <td>14.388889</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-12T14_36_55_arena3</td>\n",
       "      <td>12.093889</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-12T16_18_15_arena4</td>\n",
       "      <td>13.795556</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-13T14_34_18_arena2</td>\n",
       "      <td>16.062778</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-20T13_43_53_arena3</td>\n",
       "      <td>13.563889</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-20T14_48_55_arena2</td>\n",
       "      <td>8.676944</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-21T13_38_55_arena4</td>\n",
       "      <td>17.289444</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-21T15_57_23_arena2</td>\n",
       "      <td>13.688611</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-26T13_40_19_arena1</td>\n",
       "      <td>14.656111</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-28T13_36_06_arena4</td>\n",
       "      <td>13.373611</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-28T14_44_01_arena3</td>\n",
       "      <td>13.663889</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-28T15_55_49_arena3</td>\n",
       "      <td>16.476389</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-12T15_50_43_arena2</td>\n",
       "      <td>8.706111</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-13T16_06_33_arena2</td>\n",
       "      <td>13.458056</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-18T15_19_17_arena3</td>\n",
       "      <td>14.773611</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-19T13_50_56_arena2</td>\n",
       "      <td>11.525556</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-20T13_21_06_arena2</td>\n",
       "      <td>15.783889</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-20T15_44_09_arena2</td>\n",
       "      <td>14.911111</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-24T16_13_35_arena4</td>\n",
       "      <td>15.100278</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-25T14_55_12_arena1</td>\n",
       "      <td>15.487778</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T13_37_48_arena3</td>\n",
       "      <td>14.748611</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T14_48_28_arena4</td>\n",
       "      <td>13.958611</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T16_11_06_arena3</td>\n",
       "      <td>12.636111</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-03T14_54_45_arena1</td>\n",
       "      <td>10.916111</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-03T16_20_50_arena4</td>\n",
       "      <td>16.828611</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-12-20T12_58_51_arena4</td>\n",
       "      <td>10.791667</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-12-20T14_01_01_arena3</td>\n",
       "      <td>10.424722</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        condition                        experiment  duration_mins  \\\n",
       "0   virgin_virgin  video_2017-09-05T13_28_41_arena4      11.689722   \n",
       "1   virgin_virgin  video_2017-09-05T14_34_55_arena2      15.268333   \n",
       "2   virgin_virgin  video_2017-09-06T13_42_13_arena1      10.491944   \n",
       "3   virgin_virgin  video_2017-09-06T14_45_32_arena3      14.310833   \n",
       "4   virgin_virgin  video_2017-09-07T14_37_38_arena3      13.040278   \n",
       "5   virgin_virgin  video_2017-09-07T14_37_38_arena4      14.475833   \n",
       "6   virgin_virgin  video_2017-09-08T13_26_13_arena3      14.261389   \n",
       "7   virgin_virgin  video_2017-09-12T13_30_06_arena4      14.388889   \n",
       "8   virgin_virgin  video_2017-09-12T14_36_55_arena3      12.093889   \n",
       "9   virgin_virgin  video_2017-09-12T16_18_15_arena4      13.795556   \n",
       "10  virgin_virgin  video_2017-09-13T14_34_18_arena2      16.062778   \n",
       "11  virgin_virgin  video_2017-09-20T13_43_53_arena3      13.563889   \n",
       "12  virgin_virgin  video_2017-09-20T14_48_55_arena2       8.676944   \n",
       "13  virgin_virgin  video_2017-09-21T13_38_55_arena4      17.289444   \n",
       "14  virgin_virgin  video_2017-09-21T15_57_23_arena2      13.688611   \n",
       "15  virgin_virgin  video_2017-09-26T13_40_19_arena1      14.656111   \n",
       "16  virgin_virgin  video_2017-09-28T13_36_06_arena4      13.373611   \n",
       "17  virgin_virgin  video_2017-09-28T14_44_01_arena3      13.663889   \n",
       "18  virgin_virgin  video_2017-09-28T15_55_49_arena3      16.476389   \n",
       "19  virgin_virgin  video_2017-10-12T15_50_43_arena2       8.706111   \n",
       "20  virgin_virgin  video_2017-10-13T16_06_33_arena2      13.458056   \n",
       "21  virgin_virgin  video_2017-10-18T15_19_17_arena3      14.773611   \n",
       "22  virgin_virgin  video_2017-10-19T13_50_56_arena2      11.525556   \n",
       "23  virgin_virgin  video_2017-10-20T13_21_06_arena2      15.783889   \n",
       "24  virgin_virgin  video_2017-10-20T15_44_09_arena2      14.911111   \n",
       "25  virgin_virgin  video_2017-10-24T16_13_35_arena4      15.100278   \n",
       "26  virgin_virgin  video_2017-10-25T14_55_12_arena1      15.487778   \n",
       "27  virgin_virgin  video_2017-11-02T13_37_48_arena3      14.748611   \n",
       "28  virgin_virgin  video_2017-11-02T14_48_28_arena4      13.958611   \n",
       "29  virgin_virgin  video_2017-11-02T16_11_06_arena3      12.636111   \n",
       "30  virgin_virgin  video_2017-11-03T14_54_45_arena1      10.916111   \n",
       "31  virgin_virgin  video_2017-11-03T16_20_50_arena4      16.828611   \n",
       "32  virgin_virgin  video_2017-12-20T12_58_51_arena4      10.791667   \n",
       "33  virgin_virgin  video_2017-12-20T14_01_01_arena3      10.424722   \n",
       "\n",
       "    has_aggression  \n",
       "0             True  \n",
       "1             True  \n",
       "2             True  \n",
       "3             True  \n",
       "4             True  \n",
       "5             True  \n",
       "6             True  \n",
       "7             True  \n",
       "8            False  \n",
       "9             True  \n",
       "10            True  \n",
       "11           False  \n",
       "12            True  \n",
       "13            True  \n",
       "14            True  \n",
       "15            True  \n",
       "16           False  \n",
       "17            True  \n",
       "18           False  \n",
       "19           False  \n",
       "20           False  \n",
       "21            True  \n",
       "22           False  \n",
       "23            True  \n",
       "24            True  \n",
       "25            True  \n",
       "26            True  \n",
       "27            True  \n",
       "28            True  \n",
       "29            True  \n",
       "30           False  \n",
       "31            True  \n",
       "32            True  \n",
       "33            True  "
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "duration_df = copulation_df.copy()\n",
    "duration_df = duration_df.query('has_cop==True')\n",
    "duration_df = duration_df[['condition', 'experiment', 'duration_mins', 'has_aggression']]\n",
    "duration_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAHkAAAEFCAYAAADHbUhHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO2deVhTV/7G3yyyhB1B2T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mHDBpSVlSE/Px+7du1CXl4e5TSHdEHLiJeRkZH875YeGw4cOBCPHz/WtiyVPH/+HA0NDQgICACPx8OUKVOQlJSEZ8+eISAgAEKhEMXFxZgxYwYOHz5Mt1wFmNY1RbKysrBgwQI0NjZCLBYjPj4eYWFhSEtLw+PHj7F79270799f5wwGaB67fpMYN24c7t69iz59+oDD4WDq1KmIjIykWxYlmLFrPYCprvUAxmQ9gDFZD2BM1gMYk/UAxmQ9gDFZD2BM1gMYk/UAxmQ9gDFZD2BM1gMYk/UAxmQ9gDFZD/h/dE3rvuj+kUgAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 90x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Initialize figure.\n",
    "n_conditions = duration_df['condition'].nunique()\n",
    "figure, axis = plt.subplots(figsize=(1.25*n_conditions, 4))\n",
    "\n",
    "# Draw the boxplot.\n",
    "sns.boxplot(x='condition',\n",
    "            y='duration_mins',\n",
    "            data=duration_df,\n",
    "            palette=['steelblue'],\n",
    "            width=0.6,\n",
    "            showfliers=False,\n",
    "            boxprops={'edgecolor': INK},\n",
    "            medianprops={'color': INK},\n",
    "            whiskerprops={'color': INK},\n",
    "            capprops={'color': INK}\n",
    "           )\n",
    "\n",
    "# Draw the swarmplot.\n",
    "sns.swarmplot(x='condition',\n",
    "              y='duration_mins',\n",
    "              data=duration_df,\n",
    "              palette=['steelblue'],\n",
    "              linewidth=0.75,\n",
    "              edgecolor=INK\n",
    "             )\n",
    "\n",
    "# Figure and axes formatting.\n",
    "axis.set_xlabel('')\n",
    "axis.set_xticklabels([''])\n",
    "axis.set_ylabel('Copulation Duration (Mins.)')\n",
    "axis.set_ylim(0, 20)\n",
    "axis.set_yticks(range(0, 20+1, 5))\n",
    "axis.set_yticklabels(list(range(0, 20+1, 5)))\n",
    "\n",
    "# Table definition.\n",
    "row1 = [str(duration_df.query('condition==\"'+condition+'\"').shape[0]) for condition in condition_order]\n",
    "cell_text = np.array([row1])\n",
    "\n",
    "row_labels = ['n =']\n",
    "summary_table = axis.table(cellText= cell_text,\n",
    "                           cellLoc='center',\n",
    "                           rowLabels=row_labels,\n",
    "                           rowLoc='center',\n",
    "                           colLoc='center',\n",
    "                          )\n",
    "\n",
    "summary_table.auto_set_font_size(False)\n",
    "summary_table.set_fontsize(11)\n",
    "\n",
    "properties = summary_table.properties()\n",
    "table_cells = properties['children']\n",
    "for cell in table_cells:\n",
    "    cell.set_height(0.12)\n",
    "    cell.set_alpha(0)\n",
    "\n",
    "# Saving parameters.\n",
    "filename = 'first_copulation_duration'\n",
    "plt.savefig(os.path.join(savepath, filename))\n",
    "\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
